#include "quickcalculation.h"
#include "struct.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>

QuickCalculation::QuickCalculation()
{
}

QuickCalculation::~QuickCalculation()
{
}

float QuickCalculation::QueteletIndexCalculation(struct UserData *data)
{
    float fResult; //Functions as the result of the calculated quetelet index.
    fResult = data->iweight/pow(data->flenght,2); //The pow function is a standard math function that can be used by using the math.h library
    return fResult;
}

QString QuickCalculation::ConvertQueteletIndexToString(float fIndex)
{
    if(fIndex < UNDERWEIGHTMARGIN_QI)
    {
        return "Underweight";
    }
    else if (fIndex > OVERWEIGHTMARGIN_QI)
    {
        return "Overweight";
    }
    else
    {
        return "Healthy weight";
    }
}
